home *** CD-ROM | disk | FTP | other *** search
/ Merciful 5 / Merciful - Disc 5.iso / software / r / real_3d / real3dv3.3b.dms / real3dv3.3b.adf / RPL.LZH / RPL / collide.rpl < prev    next >
Text File  |  1995-04-18  |  2KB  |  60 lines

  1.  
  2. ( Collision detection hook examples
  3. ( ---------------------------------
  4.  
  5. ( Some useful words
  6. ( -----------------
  7. : Rebound ; 
  8. : NoRebound  2 l STORE ;
  9. : CancelAnim 0 l STORE ;
  10.  
  11.  
  12. ( This hook makes the objects invisible as soon as they collide
  13. ( -------------------------------------------------------------
  14. : CollInvisible
  15.     0 o1 FETCH o2 FETCH 
  16.     lOF_RTINVISIBLE lOF_WFINVISIBLE + 0 2 M_ATTRIB
  17.     NoRebound
  18. ;
  19.  
  20. ( This hook shrinks the collided objects about their COGs a bit in each 
  21. ( collision.
  22. ( ---------------------------------------------------------------------
  23. : CollSize
  24.     ( make collided objects smaller
  25.     0 o1 FETCH DUP iOP_COG O_PROP 0.8 0 M_SIZE3D
  26.     0 o2 FETCH DUP iOP_COG O_PROP 0.8 0 M_SIZE3D
  27.     Rebound
  28. ;
  29.  
  30.  
  31. ( This hook tries to avoid collision by shrinking the objects and
  32. ( disabling collision processing.
  33. ( ---------------------------------------------------------------
  34. : CollAvoid
  35.     0 o1 FETCH DUP iOP_COG O_PROP 0.7 0 M_SIZE3D
  36.     0 o2 FETCH DUP iOP_COG O_PROP 0.7 0 M_SIZE3D
  37.     NoRebound
  38. ;
  39.  
  40. ( This example opens a requester for each detected collision
  41. ( -----------------------------------------------------------
  42. : CollHurts
  43.     "STOP ANIMATION|I DON'T MIND" "OUTS! It hurts" GET_KEY
  44.     IF
  45.         CancelAnim
  46.     ELSE
  47.         Rebound
  48.     ENDIF
  49. ;
  50.  
  51. ( This hook copies a file 'R3D2:macros/speak to the SPEAK: device
  52. ( causing your Amiga to say 'Oooh' whenever objects collide. Make
  53. ( sure you have mounted the device SPEAK: before trying this.
  54. ( ---------------------------------------------------------------
  55. : CollSayOooh
  56.     "echo Oooh >SPEAK:" SYSTEM
  57.     Rebound
  58. ;
  59.  
  60.